package operation;

import book.BookList;

import java.util.Scanner;

public class Find implements Ioperation{
    @Override
    public void work(BookList booklist) {
        String bookName = null;
        System.out.println("请输入你要查找的书名：");
        Scanner scan = new Scanner(System.in);
        bookName = scan.nextLine();

        int currentSize = booklist.getCurrentSize();
        for (int i = 0; i < currentSize; i++) {
            if(booklist.getBooks(i).getName().equals(bookName)){
                System.out.println("找到了！！！");
                System.out.println(booklist.getBooks(i));
                return;
            }
        }

        System.out.println("没有找到这本书！！！");
    }
}
